#ifndef PACKETMANAGER_H
#define PACKETMANAGER_H

#include <QObject>
#include <map>
#include <list>
#include "api.h"
#include "packet.h"
#include "ainterpreter.h"
#include "maininterpreter.h"

class PacketManager : public QObject
{
	Q_OBJECT

public:
	PacketManager(Api &api, QObject *parent);
	~PacketManager();
	void											initInterpreters();

private:
	std::map<byte, std::list<AInterpreter *> >		_itptMap;
	Api &											_api;

public:
	void											interpret(Packet & pkg);
	void											deleteInterpreter();
	void											addInterpreter(byte, AInterpreter *);
	byte											getProto(Packet &pkg);

	Packet											*buildPacket(byte proto, byte op);
};

#endif // PACKETMANAGER_H
